﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ICM_Cal_Price_Account.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Edit_Form.ICM_Cal_Price_Account" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <title>รายการแสดงราคาทางบัญชี</title>
    <link rel="StyleSheet" href="../../Styles/StyleSheet.css" type="text/css"/>
</head>
<body>
    <form id="form1" runat="server">
         <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" >
              
         </asp:ScriptManager>
         
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        
                <script type="text/javascript" src="../../Scripts/Common.js"></script>
                <script type="text/javascript">
                Sys.Application.add_load(setCalendarStartDateCalDepreTable);
                Sys.Application.add_load(setCalendarEndDateCalDepreTable);
                 //========================= StartDateCalDepreciation ============================//
                function setCalendarStartDateCalDepreTable() {
                    var tooltip = $find("<%= ToolTipStartDateCalDepre.ClientID %>");
                    var calendar = $find("<%= CalendarStartDateCalDepre.ClientID %>");                       
                    var fastNavigation = calendar._getFastNavigation();
                    fastNavigation.OnToday =
                    function()
                    {
                        var today = new Date;
                        var date = [today.getFullYear(), today.getMonth()+ 1, today.getDate()];
                        calendar.selectDate(date, true);
                        fastNavigation.Popup.Hide();  
                        var all_date = date.toString().split(",");
                        var year = parseInt(all_date[0]) + 543;
                        var month = all_date[1];
                        var day = all_date[2];
                        if (day.length == 1) {
                            day = '0' + day;
                        }
                        if (month.length == 1) {
                            month = '0' + month;
                        }

                        var maskText = $find("<%= txtStartDateCalDepre.ClientID %>");
                        maskText.set_value(day + month + year);
                        tooltip.hide();
                    }
                }
                function OnStartDateCalDepreClick(calendarInstance, args) {
                    var tooltip = $find("<%= ToolTipStartDateCalDepre.ClientID %>");
                    var fastNavigation = calendarInstance._getFastNavigation();
                    var date = args.get_renderDay().get_date().toString();
                    var all_date = date.split(",");
                    var year = parseInt(all_date[0]) + 543;
                    var month = all_date[1];
                    var day = all_date[2];
                    if (day.length == 1) {
                        day = '0' + day;
                    }
                    if (month.length == 1) {
                        month = '0' + month;
                    }

                    var maskText = $find("<%= txtStartDateCalDepre.ClientID %>");
                    maskText.set_value(day + month + year);
                    tooltip.hide();
                }
                function OnCalendarStartDateCalDepreViewChanged(sender, step) {
                    var year = parseInt(sender.FocusedDate[0]) + 543;
                    var month = sender.FocusedDate[1];
                    document.getElementById("CalendarStartDateCalDepre_Title").innerHTML = changeMonthNumberToName(month) + " " + year; 
                }
                //========================= EndDate Cal Depreciation ============================//
                function setCalendarEndDateCalDepreTable() {
                    var tooltip = $find("<%= ToolTipEndDateCalDepre.ClientID %>");
                    var calendar = $find("<%= CalendarEndDateCalDepre.ClientID %>");                       
                    var fastNavigation = calendar._getFastNavigation();
                    fastNavigation.OnToday =
                    function()
                    {
                        var today = new Date;
                        var date = [today.getFullYear(), today.getMonth()+ 1, today.getDate()];
                        calendar.selectDate(date, true);
                        fastNavigation.Popup.Hide();  
                        var all_date = date.toString().split(",");
                        var year = parseInt(all_date[0]) + 543;
                        var month = all_date[1];
                        var day = all_date[2];
                        if (day.length == 1) {
                            day = '0' + day;
                        }
                        if (month.length == 1) {
                            month = '0' + month;
                        }

                        var maskText = $find("<%= txtEndDateCalDepre.ClientID %>");
                        maskText.set_value(day + month + year);
                        tooltip.hide();
                    }
                }
                function OnEndDateCalDepreClick(calendarInstance, args) {
                    var tooltip = $find("<%= ToolTipEndDateCalDepre.ClientID %>");
                    var fastNavigation = calendarInstance._getFastNavigation();
                    var date = args.get_renderDay().get_date().toString();
                    var all_date = date.split(",");
                    var year = parseInt(all_date[0]) + 543;
                    var month = all_date[1];
                    var day = all_date[2];
                    if (day.length == 1) {
                        day = '0' + day;
                    }
                    if (month.length == 1) {
                        month = '0' + month;
                    }

                    var maskText = $find("<%= txtEndDateCalDepre.ClientID %>");
                    maskText.set_value(day + month + year);
                    tooltip.hide();
                }
                function OnCalendarEndDateCalDepreViewChanged(sender, step) {
                    var year = parseInt(sender.FocusedDate[0]) + 543;
                    var month = sender.FocusedDate[1];
                    document.getElementById("CalendarEndDateCalDepre_Title").innerHTML = changeMonthNumberToName(month) + " " + year; 
                }
                //=================================== Utility =================================//
                 function onTextChangeGeneral(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                 }
                 function GetRadWindow() 
                 {
                        var oWindow = null;
                        if (window.radWindow)
                            oWindow = window.RadWindow; 
                        else if (window.frameElement.radWindow)
                            oWindow = window.frameElement.radWindow; 
                        return oWindow;
                 }
                 function CloseWindow() 
                 {
                         GetRadWindow().Close();
                 }
                </script>
        </telerik:RadCodeBlock>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="Panel1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                <telerik:AjaxUpdatedControl ControlID="Panel2" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="Panel2">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                <telerik:AjaxUpdatedControl ControlID="Panel2" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
            </telerik:RadAjaxManager>
        
                         <div class="moduleContent1000">
                                 <div class="moduleDivBottom1000">
                                                <asp:Panel ID="Panel2" runat="server" CssClass="contentPaneDiv" Height="30px"  ScrollBars="Auto" >
                                                     <table cellpadding="0" cellspacing="0">
                                                        <tr class="command-list">
                                                            <td>
                                                                <asp:Label ID="hicm_cal_price_account_seq" runat = "server" Visible ="false" />
                                                                <asp:Label ID="hcal_price_account" runat = "server" Visible ="false" />
                                                                <asp:Label ID="hStatus" runat = "server" Visible ="false" />
                                                                <asp:LinkButton ID="btnSave" runat="server" CssClass="LinkButton" Visible="true" onclick="btnSave_Click">
                                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                                                </asp:LinkButton>
                                                            </td>
                                                            <td class="command-item">
                                                                <asp:LinkButton ID="btnCancel" runat="server" CssClass="LinkButton" Visible="true" onclick="btnCancel_Click">
                                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ยกเลิก
                                                                </asp:LinkButton>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </asp:Panel> 
                               </div>
                       </div>                 
                         <div class="moduleContent1000">
                            <div class="moduleDivBottom1000">
                              <asp:Panel ID="Panel1" runat="server" CssClass="contentPaneDiv" Height="299px" ScrollBars="Auto"  >  
                                        <asp:Panel ID="panelHeaderList" runat="server">
                                                <div class="header-grid">
                                                    <asp:Label ID="lblHeaderList" runat="server" Text="ราคาทางบัญชี"></asp:Label>
                                                </div>
                                        </asp:Panel>
                                        <div class="formList-detail">
                                               <table>
                                                     <tr>
                                                            <td width="170px">
                                                                <asp:Label CssClass="font-label" runat = "server" ID= "lblAssetCode" Text = "รหัสพัสดุ          : " Font-Bold="true"/>
                                                            </td>
                                                            <td>
                                                                <telerik:RadComboBox ID="cmbAssetCode" runat="server" 
                                                                            AllowCustomText="true" EmptyMessage="< รายการวัสดุ >" 
                                                                            EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                                            HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                                            OnClientTextChange="onTextChangeGeneral" 
                                                                            OnItemsRequested="cmbAssetCode_ItemsRequested" 
                                                                            ShowDropDownOnTextboxClick="true" ShowMoreResultsBox="true" Width="700px">
                                                                            <HeaderTemplate>
                                                                                <table cellpadding="0" cellspacing="0" class="font-label">
                                                                                    <tr>
                                                                                        <td align="center" width="150px"><b>รหัสพัสดุ</b></td>
                                                                                        <td align="center" width="200px"><b>ชื่อพัสดุ</b></td>
                                                                                        <td align="center" width="200px"><b>รายละเอียดของพัสดุ</b></td>
                                                                                    </tr>
                                                                                </table>
                                                                            </HeaderTemplate>
                                                                            <ItemTemplate>
                                                                                <asp:Table ID="tableAsset" runat="server" CellPadding="0" 
                                                                                    CellSpacing="0" CssClass="font-label">
                                                                                </asp:Table>
                                                                            </ItemTemplate>
                                                                        </telerik:RadComboBox>
                                                            </td>
                                                     </tr>        
                                               </table>
                                        </div>
                                        <div class="formList-detail">
                                               <table>
                                                     <tr>
                                                            <td width="170px">
                                                                <asp:Label CssClass="font-label" runat = "server" ID= "lblFiscal" Text = "งวดบัญชี          : " Font-Bold="true"/>
                                                            </td>
                                                            <td>
                                                                     <telerik:RadComboBox ID="cmbFiscal" Runat="server"
                                                                                    DataTextField="icm_obj_type_name" DataValueField="icm_obj_type_seq" 
                                                                                    EnableLoadOnDemand="true" 
                                                                                    ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                                                                    EmptyMessage="< เลือกงวดทางบัญชี >" AllowCustomText="true" Filter="Contains"
                                                                                    OnClientTextChange="onTextChangeGeneral"
                                                                                    OnItemsRequested="cmbFiscal_ItemsRequested" Width="700px" >
                                                                      </telerik:RadComboBox>
                                                                      &nbsp;<label id="Label15" runat="server"><font color="red">*</font></label>
                                                            </td>
                                                     </tr>        
                                               </table>
                                        </div>
                                        <div class="formList-detail">
                                                               <table>
                                                                     <tr>
                                                                            <td valign="top" width="170px">
                                                                                <asp:Label CssClass="font-label" runat = "server" ID= "lblStartDateCalDepre" Text = "วันที่เริ่มต้นการคิดค่าเสื่อม          : " Font-Bold="true"/>
                                                                                </td>
                                                                            <td>
                                                                                <telerik:RadMaskedTextBox ID="txtStartDateCalDepre" runat="server" Mask=" ##/##/####" SelectionOnFocus="SelectAll" TextWithLiterals=" //" Width="75px">
                                                                                </telerik:RadMaskedTextBox>
                                                                            </td>
                                                                            <td>
                                                                                  <asp:LinkButton ID="lbtStartDateCalDepre" runat="server" CssClass="LinkButton">
                                                                                        <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                                                                  </asp:LinkButton>
                                                                                  <telerik:RadToolTip ID="ToolTipStartDateCalDepre" runat="server" Animation="None" HideEvent="LeaveToolTip" Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                                                    TargetControlID="lbtStartDateCalDepre" Modal="true">
                                                                                        <telerik:RadCalendar id="CalendarStartDateCalDepre" runat="server" TitleFormat="MMMM yyyy" EnableMultiSelect="false" UseRowHeadersAsSelectors="false" UseColumnHeadersAsSelectors="false" DayCellToolTipFormat="dddd, dd MMMM, yyyy" NavigationPrevToolTip="เดือนก่อนหน้า" NavigationNextToolTip="เดือนถัดไป" FastNavigationNextToolTip="3 เดือนถัดไป" FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                                                            <ClientEvents OnDateClick="OnStartDateCalDepreClick" OnCalendarViewChanged="OnCalendarStartDateCalDepreViewChanged"></ClientEvents>
                                                                                            <FastNavigationSettings EnableTodayButtonSelection="true" TodayButtonCaption="ไปที่วันนี้" OkButtonCaption="เปลี่ยน" CancelButtonCaption="ยกเลิก" />
                                                                                        </telerik:RadCalendar>
                                                                                  </telerik:RadToolTip>
                                                                                    &nbsp;<label id="Label2" runat="server"><font color="red">*</font></label>
                                                                            </td>
                                                                     </tr>
                                                               </table>
                                               </div>
                                        <div class="formList-detail">
                                                               <table>
                                                                     <tr>
                                                                            <td valign="top" width="170px">
                                                                                <asp:Label CssClass="font-label" runat = "server" ID= "lblEndDateCalDepre" Text = "วันที่สิ้นสุดการคิดค่าเสื่อม           : " Font-Bold="true"/>
                                                                                </td>
                                                                            <td>
                                                                                <telerik:RadMaskedTextBox ID="txtEndDateCalDepre" runat="server" Mask=" ##/##/####" SelectionOnFocus="SelectAll" TextWithLiterals=" //" Width="75px">
                                                                                </telerik:RadMaskedTextBox>
                                                                            </td>
                                                                            <td>
                                                                                  <asp:LinkButton ID="lbtEndDateCalDepre" runat="server" CssClass="LinkButton">
                                                                                        <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                                                                  </asp:LinkButton>
                                                                                  <telerik:RadToolTip ID="ToolTipEndDateCalDepre" runat="server" Animation="None" HideEvent="LeaveToolTip" Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                                                    TargetControlID="lbtEndDateCalDepre" Modal="true">
                                                                                        <telerik:RadCalendar id="CalendarEndDateCalDepre" runat="server" TitleFormat="MMMM yyyy" EnableMultiSelect="false" UseRowHeadersAsSelectors="false" UseColumnHeadersAsSelectors="false" DayCellToolTipFormat="dddd, dd MMMM, yyyy" NavigationPrevToolTip="เดือนก่อนหน้า" NavigationNextToolTip="เดือนถัดไป" FastNavigationNextToolTip="3 เดือนถัดไป" FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                                                            <ClientEvents OnDateClick="OnEndDateCalDepreClick" OnCalendarViewChanged="OnCalendarEndDateCalDepreViewChanged"></ClientEvents>
                                                                                            <FastNavigationSettings EnableTodayButtonSelection="true" TodayButtonCaption="ไปที่วันนี้" OkButtonCaption="เปลี่ยน" CancelButtonCaption="ยกเลิก" />
                                                                                        </telerik:RadCalendar>
                                                                                  </telerik:RadToolTip>
                                                                                    &nbsp;<label id="Label4" runat="server"><font color="red">*</font></label>
                                                                            </td>
                                                                     </tr>
                                                               </table>
                                               </div>    
                                               <div class="formList-detail">
                                                               <table>
                                                                     <tr>
                                                                            <td width="170px">
                                                                                 <asp:Label CssClass="font-label" runat = "server" ID= "lblRemark" Text = "หมายเหตุเพิ่มเติม          : " Font-Bold="true"/>
                                                                            </td>
                                                                            <td>
                                                                                 <telerik:RadTextBox ID="txtRemark" runat="server" title="กรอกหมายเหตุเพิ่มเติม" Width="700px" Height="55px" TextMode="MultiLine" ></telerik:RadTextBox>
                                                                            </td>
                                                                     </tr>
                                                               </table>
                                               </div> 
                             </asp:Panel>
                       </div>
                 </div>                                    
            
                    
    </form>
</body>
</html>
